Hi! Sorry to interrupt, but I'm currently looking for work.
If you know anyone looking for a recent CompSci graduate with deep experience in strictly-typed languages like Rust, please send the listing to me or send my Resume over!
I'm based in Brighton, UK and looking for roles in and around the London area, or remote. Thanks!


   (Sets a cookie in your browser)

Making embed images with Typst

🕒


Just making a quick post to show off new functionality. I saw a couple websites using Typst to generate OpenGraph embed images. I basically took the implementation from crates.io's crates_io_og_image library. (It's MIT licensed, I'm allowed to!)

One thing I noticed: invoking Typst is slow slow. I ended up having to add caching to keep rendered images around.

Another issue was that Discord embeds were, like, wrong? Well first, they looked like this:

Screenshot of discord

I looked at MDN's embed meta tags, and saw that they used this:

html
<meta name="og:image:type" content="image/png">
<meta name="og:image:height" content="1080">
<meta name="og:image:width" content="1920">
<meta name="og:image:alt" content="The MDN Web Docs logo, featuring a blue accent color, displayed on a solid black background.">

I thought that maybe it couldn't determine the size, so used a small version? So I updated my site, and it still wasn't working. So I looked again, and noticed this rather unassuming tag:

html
<meta name="twitter:card" content="summary_large_image">
drawing of a sad or worried deer, talking to you.

*sigh* Why is Twitter here?? Do I have to add this to my website?

I guess so. I went to Discord's embed tester, and it explicitly says that they use Twitter embed stuff. I suppose this stuff isn't really specified. I feel like OpenGraph should add something like this eventually.

Anyway, I added all of this stuff and it worked. Yaaay.

Screenshot of discord

Here's a sample embed:

an embed image

There's a chance that I could accidentally mess this up if I put a big title or subtitle in. That would be pretty funny.